package com.cheng.example.geektime.designpatterns.j46.v3;
import lombok.Data;



/**
 * @author chengshuai
 * @version 1.0
 * @date 2020/6/10 13:19
 */


/**
 *
 * 建造者模式防止无效对象
 *
 */
@Data
public class Rectangle {

    private int height;

    private int width;


    public Rectangle(int height, int width) {
        this.height = height;
        this.width = width;
    }

    public static void main(String[] args) {

//        Rectangle r = new Rectangle(); // r is invalid
//        r.setWidth(2); // r is invalid
//        r.setHeight(3); // r is valid

        Rectangle rectangle = new Rectangle(20, 10);

    }

}
